#ifndef CAMERA_H
#define CAMERA_H


#include "pbrt.h"
#include "geometry.h"
#include "transform.h"

struct CameraSample {
    float imageX, imageY;
    float lensU, lensV;
    float time;
};

class Film {
public:
    // Film Interface
    Film(int xres, int yres)
        : xResolution(xres), yResolution(yres) { }

    const int xResolution, yResolution;
};



// Camera Declarations
class Camera {
public:
    // Camera Interface
    Camera(const Transform &cam2world, float sopen, float sclose, Film *film);
    virtual ~Camera();
    virtual float GenerateRay(const CameraSample &sample,
                              Ray *ray) const = 0;

    // Camera Public Data
    Transform CameraToWorld;
    const float shutterOpen, shutterClose;
    Film *film;

};


class ProjectiveCamera : public Camera {
public:
    // ProjectiveCamera Public Methods
    ProjectiveCamera(const Transform &cam2world,
        const Transform &proj, const float screenWindow[4],
        float sopen, float sclose, float lensr, float focald, Film *film);
protected:
    // ProjectiveCamera Protected Data
    Transform CameraToScreen, RasterToCamera;
    Transform ScreenToRaster, RasterToScreen;
    float lensRadius, focalDistance;
};



#endif // CAMERA_H
